class Solution {
    public int[] twoSum(int[] price, int target) {
        int right=price.length-1;
        int left=0;
        while(price[left]+price[right]!=target){
            if(price[left]+price[right]>target){
                right--;
            }
            else{
                left++;
            }
        }
        int []a={price[left],price[right]};
        return a;
    }
}